package DailyPractice.Day21;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author lumin
 * @date 2022/05/17 20:47
 **/
public class Num2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int All = sc.nextInt();
        String str = sc.next();
        int[] arr = new int[All];
        for (int i = 0; i < All; i++) {
            arr[i] = i + 1;
        }
        //当前光标位置
        int s = 0;
        //遍历指令
        int index = 0;
        int left = 0;
        int right = 0;
        if(All >= 3){
            right = 3;
            while(index < str.length()){
                if(str.charAt(index) == 'U'){
                    if(isSZU(left,s,right,All)){
                        left = All - 4;
                        right = left + 3;
                        s = right;
                        index++;
                        continue;
                    }
                    if(s == left){
                        left--;
                        s--;
                        right--;
                    }else{
                        s--;
                    }
                }
                if(str.charAt(index) == 'D'){
                    if(isSZD(left,s,right,All)){
                        left = 0;
                        right = left + 3;
                        s = left;
                        index++;
                        continue;
                    }
                    if(s == right){
                        left++;
                        s++;
                        right++;
                    }else{
                        s++;
                    }
                }
                index++;
            }
            for (int i = left; i < right; i++) {
                System.out.print(arr[i]+" ");
            }
            System.out.println(arr[right]);
            System.out.println(arr[s]);
        }else{
            right = All - 1;
            if(All == 1){
                System.out.println(arr[0]);
                System.out.println(arr[s]);
            }else{
                while(index < str.length()){
                    if(str.charAt(index) == 'U'){
                        if(isSZU(left,s,right,All)){
                            s = right;
                            index++;
                            continue;
                        }else{
                            s--;
                        }
                    }
                    if(str.charAt(index) == 'D'){
                        if(isSZD(left,s,right,All)){
                            s = left;
                            index++;
                            continue;
                        }else{
                            s++;
                        }
                    }
                    index++;
                }
                for (int i = left; i < right; i++) {
                    System.out.print(arr[i] + " ");
                }
                System.out.println(arr[right]);
                System.out.println(arr[s]);
            }
        }
    }
    private static boolean isSZD(int left, int s, int right, int all) {
        if(right == all - 1 && s == right){
            return true;
        }
        return false;
    }

    //判断光标和left是不是都在0
    private static boolean isSZU(int left, int s,int right,int All) {
        if(left == 0 && s == left){
            return true;
        }
        return false;
    }
//    public static void moveS(int left, int s, char a, int right, int All){
//        if(a == 'U'){
//            if(isSZU(left,s,right,All)){
//                left = All - 3;
//                right = left + 2;
//                s = right;
//            }
//            if(s == left){
//                left--;
//                s--;
//                right--;
//            }else{
//                s--;
//            }
//        }
//        if(a == 'D'){
//            if(isSZD(left,s,right,All)){
//                left = 0;
//                right = left + 3;
//                s = left;
//            }
//            if(s == right){
//                left++;
//                s++;
//                right++;
//            }else{
//                s++;
//            }
//        }
//    }


}